package com.lsh.airticket.service.impl;

import com.lsh.airticket.dao.CityDao;
import com.lsh.airticket.entity.City;
import com.lsh.airticket.service.CityService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

/**
 * @author lsh
 * @date 2021/2/15
 **/
@Service
public class CityServiceImpl implements CityService {

    @Autowired
    CityDao cityDao;

    @Override
    public List<City> findAllCity() {
        return cityDao.findTbCityAll();
    }

    @Override
    public int addCity(String name) {
        City city = new City();
        city.setCityName(name);
        city.setCityCreatetime(new Date());
        int i = cityDao.insertTbCity(city);
        return i;
    }

    @Override
    public int updateCity(City city) {
        return cityDao.updateTbCity(city);
    }

    @Override
    public int deleteCityById(Integer cityId) {
        return cityDao.deleteTbCityById(cityId);
    }
}
